#ifndef CACHE_SET_H
#define CACHE_SET_H


#include <vector>

#include "CacheLine.hpp"
#include "AssocContainer.h"

#include "cache_types.h"

template <typename TData>
class CacheSet:public AssocContainer
{
   public:
      struct CacheSetAccessResult {
         CacheSetAccessResult()
            : what(CACHE_ERROR), flushed(false), invalidated(false), line(NULL)
         {}
         CacheAccess what;
         bool flushed;
         bool invalidated;
         const CacheLine<TData> * line;
      };

      virtual CacheAccess find (address_t addr)=0;
      virtual CacheAccess read (address_t addr, address_t & evicted,Directory & dirEvict,
              Directory & dirEntry,TData & data,uint32_t thread=0,uint32_t dirPage=0) = 0;
      virtual CacheAccess writeAllocate (const address_t addr, address_t  & evicted,
              uint32_t thread=0,TData data=0,uint32_t dirPage=0) = 0;
      virtual CacheAccess writeNonAllocate (address_t addr,uint32_t thread=0,
              TData data=0,uint32_t dirPage=0) = 0;
      virtual bool invalidate (address_t address) = 0;
      virtual bool flush (address_t address) = 0;
      virtual uint32_t flushDirEntry (address_t address,uint32_t thread,uint32_t page)=0;
      virtual void flush () = 0;

      CacheSet(uint16_t size)
         : AssocContainer(size)
      {
      }
      ~CacheSet() {}
/*
      inline const CacheSetAccessResult * getResult() const
      {
         return &this->result;
      }

   protected:
      CacheSetAccessResult result;
      */
};

#endif
